import * as THREE from 'three'
import { CSS3DRenderer } from 'three/examples/jsm/renderers/CSS3DRenderer'

// 初始化渲染器
const renderer = new THREE.WebGLRenderer({
    // 抗锯齿
    antialias: true,
    logarithmicDepthBuffer: true,   // 防止贴得近的2个物体会一闪一闪的
    // physicallyCorrectLights: true
})
// 设置渲染尺寸大小
renderer.setSize(window.innerWidth, window.innerHeight)
renderer.shadowMap.enabled = true
renderer.toneMapping = THREE.ACESFilmicToneMapping
renderer.toneMappingExposure = 1

// 3D HTML元素渲染器
const css3drenderer = new CSS3DRenderer()
css3drenderer.setSize(window.innerWidth, window.innerHeight)
document.querySelector('#cssrender').appendChild(css3drenderer.domElement)

export default {renderer, css3drenderer};